<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function doSomething(name) {
            console.log('Hello, ' + name);
            console.log(this)
        }
        const obj = {
            name: 'zs'
        }
        function loggingDecorator(wrapped) {
            return function () {
                console.log('Starting');
                console.log(this)
                const result = wrapped.call(this, this.name);
                console.log('Finished');
                return result;
            }
        }

        const wrapped = loggingDecorator(doSomething);
        wrapped.call(obj)
        
    </script>
</head>

<body>

</body>

</html>
